﻿using BaseAuthRole.AspNetCore.Filters;
using log4net;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TPWorkPlat.DTO.Input;
using TPWorkPlat.IService;

namespace TPWorkPlat.Server.Api
{
    /// <summary>
    /// 测试接口【无需参考】
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private ITestService _testService;

        private ILog logger = log4net.LogManager.GetLogger("TestController");

        public TestController(ITestService testService) { 
                
            _testService = testService;
            //测试提交
        }

        [ApiAuthCheckFilter]
        [HttpPost]
        public IActionResult Add([FromBody]TestAddInput test) {
            
            var r=_testService.Add(test);

            return Ok(r);
        
        }

        [HttpGet]
        public IActionResult Get(string id)
        {

            logger.Info(id);
            logger.Debug(id);
            logger.Warn(id);
            logger.Error(id);

            var r = _testService.Get(id);

            return Ok(r);

        }

        [ApiAuthCheckFilter]
        [HttpGet]
        public IActionResult UserAuthTest()
        {

           

            return Ok("");

        }

        [AppAccessCheckFilter]
        [HttpGet]
        public IActionResult AppAuthTest()
        {

           

            return Ok("");

        }
    }
}
